package com.guli.vodtest;

import com.aliyun.vod.upload.impl.UploadVideoImpl;
import com.aliyun.vod.upload.req.UploadVideoRequest;
import com.aliyun.vod.upload.resp.UploadVideoResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.exceptions.ClientException;

/**
 * @author zxc
 * @date 2023/04/08 16:23
 **/
// 上传本地音视频文件到阿里云
public class VideoDemo4 {
    public static void main(String[] args) throws ClientException {

        // 1.获取音视频文件上传的request和response
        UploadVideoRequest request = new UploadVideoRequest("LTAI5tGoduzd9bgBczsfeL6K",
                "Bggqknbss9p7o5lUE6sEvVZc3ZuwoL" , "upload-Video-Demo1" ,
                "F:\\Java项目\\学院\\项目资料\\1-阿里云上传测试视频\\6 - What If I Want to Move Faster.mp4");
        /* 可指定分片上传时每个分片的大小，默认为2M字节 */
        request.setPartSize(2 * 1024 * 1024L);
        /* 可指定分片上传时的并发线程数，默认为1，（注：该配置会占用服务器CPU资源，需根据服务器情况指定）*/
        request.setTaskNum(1);

        UploadVideoResponse response = new UploadVideoResponse();
        // 2.获取音视频文件上传的对象;
        UploadVideoImpl uploadVideo = new UploadVideoImpl();
        // 3.调用uploadVideo对象中所封装的上传音视频文件的方法;
        response = uploadVideo.uploadVideo(request);
        // 4.从response中，获取到 上传音视频文件的id值;
        String videoId = response.getVideoId();
        System.out.println("videoId ：" + videoId);
    }
}
